/**
  ******************************************************************************
  * @file    Project/main.h 
  * @author  Zlf
  * @version V1.0.0
  * @date    2018-06-10
  * @brief   Header for main.c module
  ******************************************************************************
  */
  
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

/* Exported macro for some configuration enable  ---------------------------- */ 
	#define SOFTWARE_VERSION  			( 123 ) // 
	#define SERVO_ALM_EN				( 1u ) 			// 1 enable servo alm
	#define SERVO_SVON_EN				( 1u ) 			// 1 enalbe servo SVON
	#define SERVO_ENC_PWRUP				( 0 ) 			// 1 dont read enc on power up 
	#define SERVO_CHECKSUM_EN 			( 1u )

	
/* Includes ------------------------------------------------------------------*/
	#include "stm32f4xx.h"

/* Include os files ----------------------------------------------------------*/
	#include "includes.h"
	#include "SEGGER_RTT.h"

/* Include system files ------------------------------------------------------*/
	#include "sys.h"
	#include "delay.h"

/* Include user header files -------------------------------------------------*/

	// global type definition file
	#include "GlobalType.h"
	#include "GlobalData.h"

	// wdg files
	#include "Wdg.h"

	// bsp files	
	#include "Input.h"
	#include "Led.h"
	#include "Weight.h"
	#include "Comm.h"
	#include "Key.h"
	#include "Fram.h"
//	#include "Servo.h"

//	#include "Fsmc.h"
//	#include "FpgaCtrl.h"
	
	// api files
	#include "kalmanfilter.h"
	#include "algorithm.h"	
//	#include "Fpga.h"
	#include "Hmi.h"
	#include "Esd.h"
	#include "Inout.h"
	#include "motorControl.h"	
	#include "speedAdjust.h"	
 
/* Exported types ------------------------------------------------------------*/	
/* Exported macro ------------------------------------------------------------*/
#ifndef BV
	#define BV(bit) (1<<(bit))
#endif

#ifndef CBI
	#define CBI(reg,bit) reg &= ~(BV(bit))
#endif

#ifndef SBI
	#define SBI(reg,bit) reg |= (BV(bit))
#endif

#ifndef is_SBI
	#define is_SBI(reg,bit) (reg & BV(bit))
	#define is_CBI(reg,bit) (!is_SBI(reg,bit))
#endif

#ifndef MIN
#define MIN(a,b) ((a<b)?(a):(b))
#endif

#ifndef MAX
#define MAX(a,b) ((a>b)?(a):(b))
#endif

#ifndef FABS
#define FABS(a) ((a>=0)?(a):(-a))
#endif

#ifndef DIFF
#define DIFF(a,b) ((a>b)?(a-b):(b-a))
#endif

/* Exported constants --------------------------------------------------------*/

/* Exported messages  ------------------------------------------------------- */

#ifdef __ESD_H
//extern OS_EVENT *qMsgCmd;
#endif

/* Exported functions ------------------------------------------------------- */

extern void hmi_task(void *pdata);
//extern void enc_task(void *pdata);
extern void comm_task(void *pdata);
extern void fpga_task(void *pdata);
extern void high_task(void *pdata);
extern void enc_task(void *pdata);

extern void task_servoenable(void *pdata);


#endif /* __MAIN_H */

